<template>
<h1>猜数字练习</h1>
  <input type="text" v-model="number" placeholder="请输入数字">
  <button @click="guess">猜一猜</button>
  <h3>小提示：{{result}}</h3>
</template>
<script setup>
import {ref} from "vue";

/*响应式变量*/
const number =ref('');
const result = ref('')
/*普通js变量*/
let num = parseInt(Math.random()*100+1);
console.log(num,typeof num);
console.log(number.value,typeof number.value)
const guess = ()=>{
  if(number.value>num){
    result.value='猜大了';
  }else if(number.value<num){
    result.value='猜小了';
  }else{
    result.value='猜对了';
  }

}

</script>


<style scoped>

</style>